#include "CAblHeal.h"
#include "CMinionNode.h"

CAblHeal::CAblHeal()
{
  // Ability Type
  type = ABL_NONE;

  // The mp cost of the ability
  cost = 10;

  // Range of the ability ( 0 Indicates non targeted spell )
  range = 0;

  // Radius of the AOE ability ( 0 for non AOE spell )
  radius = 0;

  // Duration of the effect
  duration = 0;

  // Delay of the ability
  delay = 2000;


  // Parameter(s) for ability
  param = new f32;

  // Param[0] = heal ratio (hp healed = matk * ratio )
  param[0] = 2.0f;


}

CAblHeal::~CAblHeal()
{
  // One parameter only
  delete param;
}


bool CAblHeal::effect()
{
  // Step 1 : Mana Check
  if ( caster->getStats().mp < cost )
  {
    std::cout << "You dont have enough mp to cast this spell." << std::endl;
    return false;
  }
  caster->getStats().mp -= cost;

  // Step 2 : Heal
  s32 heal = caster->getStats().mAtk * param[0];

  // Heals
  caster->updateHp(heal, false);

  return true;

}
